-
Notifications
You must be signed in to change notification settings - Fork 598
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(over window): window function RANGE
frame support in frontend
#14648
Conversation
Current dependencies on/for this PR:
This stack of pull requests is managed by Graphite. |
27c8004
to
980d29d
Compare
11fef80
to
7e0f0f8
Compare
980d29d
to
dfe1a5b
Compare
15a1f60
to
4398f57
Compare
c25c28f
to
8f5ed91
Compare
49dd458
to
5fba65c
Compare
8f5ed91
to
d3eba36
Compare
5fba65c
to
ea66a9c
Compare
d3eba36
to
9933c72
Compare
a4febe8
to
d2172f3
Compare
9933c72
to
d23eeca
Compare
d2172f3
to
2264345
Compare
d23eeca
to
bd2ed75
Compare
f4e3e18
to
68b4623
Compare
bd2ed75
to
16f5d06
Compare
46f031e
to
8566755
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Generally LGTM
let mut offset = self.bind_expr(offset)?; | ||
if !offset.is_const() { | ||
return Err(ErrorCode::InvalidInputSyntax( | ||
"offset in window frame bounds must be constant".to_string(), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We have a ConstEvalRewriter
. Perhaps it can help here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
BTW, I saw we did constant folding at the last step in optimization.
risingwave/src/frontend/src/optimizer/mod.rs
Lines 399 to 400 in 8fdd0ba
// Const eval of exprs at the last minute | |
plan = const_eval_exprs(plan)?; |
Shall we do it at the beginning instead? @kwannoel cc. @chenzl25
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can use ConstEvalRewriter
to do constant folding if necessary. Here is the binder phase.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh, indeed. Here is the binder phase 😄
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yep, I do constant folding in binder phase here because I want to bind the expression to well-formed Rust types FrameBound<usize>
and FrameBound<ScalarImpl>
, so that later process can be easy. I guess it does few harm since it should always be simply a constant value/expr.
proto/expr.proto
Outdated
// The order type of order column in `RANGE` frame. | ||
optional common.OrderType order_type = 15; | ||
// The data type of offset value in `RANGE` frame. | ||
optional data.DataType offset_data_type = 20; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It would look better if we split the the oneof offset
as well. IIUC, the integer
there was designed for row frames while datum
was designed for range frames. The result will be like:
oneof Frame {
RowFrame row = 1;
RangeFrame range = 2;
}
message RowFrame {...}
message RangeFrame {...}
However I also consider it's hard to keep compatibablity in this way...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You're right! I adjusted the proto messages in the latest commit 4f49c79 to deprecate the old fashion and align the messages with Rust types. Seems not that hard to maintain compatibility.
Signed-off-by: Richard Chien <[email protected]>
Signed-off-by: Richard Chien <[email protected]>
Signed-off-by: Richard Chien <[email protected]>
Signed-off-by: Richard Chien <[email protected]>
Signed-off-by: Richard Chien <[email protected]>
Signed-off-by: Richard Chien <[email protected]>
Signed-off-by: Richard Chien <[email protected]>
Signed-off-by: Richard Chien <[email protected]>
Signed-off-by: Richard Chien <[email protected]>
Signed-off-by: Richard Chien <[email protected]>
Signed-off-by: Richard Chien <[email protected]>
Signed-off-by: Richard Chien <[email protected]>
Signed-off-by: Richard Chien <[email protected]>
Signed-off-by: Richard Chien <[email protected]>
…nd` to `FrameBound<RangeFrameOffset>` Signed-off-by: Richard Chien <[email protected]>
ee5fa37
to
46f45dd
Compare
I hereby agree to the terms of the RisingWave Labs, Inc. Contributor License Agreement.
What's changed and what's your intention?
This PR:
RANGE
frame support in parser and binder;call.rs
to represent concepts related to range frame, includingRangeFrameBounds
andRangeFrameOffset
.15x out of 6xx lines of addition are planner tests, reviewers plz don't panic.
Checklist
./risedev check
(or alias,./risedev c
)Documentation
Release note
If this PR includes changes that directly affect users or other significant modifications relevant to the community, kindly draft a release note to provide a concise summary of these changes. Please prioritize highlighting the impact these changes will have on users.